package com.itheima.commons.model.vo;

import cn.hutool.core.date.DateUtil;
import com.itheima.commons.model.domain.UserFreeze;
import com.itheima.commons.model.mongo.Publish;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

//运营日志
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OperationLogVo {


    private Long id;// 日志序号
    private String adminName;// 操作人
    private String ip;//  用户ip
    private String operationTime;// 操作时间
    private String operationContent;//操作内容
    private String operationDescribe;//描述
    private LogDetailsVo logDetailsVo;
    //private

    public OperationLogVo(Publish publish,String adminName){
        this.adminName = adminName;
        this.ip = "198.168.12.1";
        this.operationTime = DateUtil.date(publish.getOpsDatetime()).toString();
        this.operationContent = "审核不通过";
        this.operationDescribe = "内容违规";
        this.logDetailsVo = new LogDetailsVo(publish,adminName);
    }

    public OperationLogVo(UserFreeze userFreeze,String adminName){
        this.adminName = adminName;
        this.ip = "198.168.12.13";
        this.operationTime = DateUtil.date(userFreeze.getFreezeStart()).toString();
        this.operationContent = "冻结";
        this.operationDescribe = userFreeze.getFreezeReason();
        this.logDetailsVo = new LogDetailsVo(userFreeze,adminName);
    }
}
